package com.anti.commom.core.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Description 业务异常
 * @Author anTi
 * @Date 2020-10-24
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private Integer code;

    private String errorMessage;

    public BusinessException(Integer code, String errorMessage) {
        super(errorMessage);
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public BusinessException(AbstractBaseExceptionEnum exception) {
        super(exception.getMessage());
        this.code = exception.getCode();
        this.errorMessage = exception.getMessage();
    }

}
